package com.stark.commons.spring.core.boot.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.stark.commons.spring.core.aspect.LogAspect;
import com.stark.commons.spring.core.support.log.DefaultLogServiceImpl;
import com.stark.commons.spring.core.support.log.LogService;

/**
 * 日志切面自动配置。
 * @author Ben
 * @since 1.0.0
 * @version 1.0.0
 */
@Configuration
public class LogAopAutoConfig {
	
	@Bean
	@ConditionalOnMissingBean(LogService.class)
	public LogService logService() {
		return new DefaultLogServiceImpl();
	}
	
	@Bean
	public LogAspect logAspect(LogService logService) {
		return new LogAspect(logService);
	}

}
